var app = getApp();
var com = require('../../common.js');
var utils=require('../../utils/util.js')
Page({
  data: {
    info: {}
  },
  onLoad: function(options) {
    var _this = this
    _this.onShopStatus()
    _this.onShopInfo()
    var timestamp = utils.formatTime(Date.parse(new Date()))
    _this.setData({
      timestamp: timestamp
    })
  },
  //获取信息
  onShopStatus() {
    var _this = this,
      i = _this.data.information
    com.link(app.link.onSaveOrderInfo + wx.getStorageSync('store') + '.st', {
      code: 'meituan'
    }, function(res) {
      console.log(res)
      _this.setData({
        info: res.data.response
      })
      console.log(res.data)
    }, "GET")
  },
  //获取信息
  onShopInfo() {
    var _this = this,
      i = _this.data.information
    com.link(app.link.onShopCentent + wx.getStorageSync('store') + '.st', {}, function(res) {
      console.log(res)
      _this.setData({
        shopInfo: res.data.data
      })
      console.log(res.data.data)
    }, "GET")
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {},
  onJumpPage() {
    wx.showModal({
      title: '提示',
      content: '确认是否签署合同吗？',
      success(res) {
        if (res.confirm) {
          com.link(app.link.onSaveOrder + wx.getStorageSync('store') + '.st', {
            code: 'meituan'
          }, function(res) {
            console.log(res)
            if (res.data.state) {
              wx.showModal({
                content: '签署成功',
                showCancel: false,
                success(res) {
                  if (res.confirm) {
                    wx.navigateTo({
                      url: '/pages/onOrderSuccess/onOrderSuccess',
                    })
                  }
                }
              })
            } else {
              wx.showModal({
                content: res.data.message,
                showCancel: false
              })
            }
          })
        }
      }
    })
  }
})